package com.bupt.liutong.admin.groupon.bo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bupt.liutong.admin.core.base.BaseBo;
import com.bupt.liutong.admin.groupon.dao.GrouponDao;
import com.bupt.liutong.admin.groupon.dto.Groupon;
import com.bupt.liutong.admin.groupon.form.GrouponForm;
import com.bupt.liutong.util.BeanUtils;

public class GrouponBo extends BaseBo {
	
	@Autowired
	private GrouponDao grouponDao;
	
	public List<GrouponForm> list(GrouponForm grouponForm) {
		Groupon groupon = new Groupon();
		BeanUtils.copyProperties(groupon, grouponForm);
		sm.pagingWithNoCriteria(grouponForm, groupon, "groupon.getGrouponsCount");
		List<Groupon> groupons = grouponDao.getGrouponsByPage(groupon);
		return BeanUtils.dtoToForm(groupons, GrouponForm.class);
	}

	public void setGrouponDao(GrouponDao grouponDao) {
		this.grouponDao = grouponDao;
	}
}
